﻿@{
    Layout = null;
    var merchant = ViewData["merchant"] as Pay.DTO.merch_detail_dto;
    string site_img = ViewData["site_img"] as string;
    var src = site_img + merchant.logo_url;

}
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>商家介绍</title>
    <meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0,maximum-scale=1.0, user-scalable=no" />
    <link rel="stylesheet" href="~/Content/css/base.css" />
    <link rel="stylesheet" href="~/Content/css/tuoken.css" />
    <script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
    <script type="text/javascript" src="~/Content/js/base.js"></script>
    <script src="~/Content/js/layer/1.9.3/layer.js"></script>
</head>

<body>
    <div class="header">
        <a href="javascript:history.go(-1);">
            <span class="back"></span>
        </a>
        <div class="hdtitle">
            商家介绍
        </div>
    </div>

    <div class="merchant_intro">
        <div class="merchant_img">
            <img src="@src" class="merchant_ico">
            <span class="name">@merchant.merch_name</span>
        </div>
        <div class="merchant_info">
            <p class="msg">@Html.Raw(merchant.detail)</p>
            @if (merchant.isAllowGetSoupValue) {
        <input type="button" class="merchant_infobtn" id="clickbtn" style="height:0.8rem;width:77%" value="@("3s后领取马力值+" + merchant.soup_value)" onclick="submit('@merchant.id')">
} else {
        <input type="button" class="merchant_infobtn" value="该任务已领取" style="height:0.8rem;width:77%" >
}

        </div>
    </div>

    <script type="text/javascript">

        var sec = 3;
        var intervalId = setInterval(function () {
            var btnObject = $('#clickbtn');
            if (sec > 0) {
                btnObject.val(sec + 's后领取马力值+@ViewData["soup_value"]');
                sec--;
            } else {

                btnObject.addClass('on');
                btnObject.removeAttr('disabled')
                btnObject.val('点击领取马力值+@ViewData["soup_value"]');
            
                clearInterval(intervalId);
            }
        }, 1000)
        function submit(id) {
            if (sec == 0) {
                $.ajax({
                    //几个参数需要注意一下
                    type: "POST",//方法类型
                    dataType: "json",//预期服务器返回的数据类型
                    url: "/Merchant/GetPower",//url
                    data: { Id: id },
                    success: function (result) {
                        if (result.result_code == 1000) {
                            layer.msg("领取成功");
                            window.location.reload();
                        } else {
                            layer.msg(result.result_msg);
                        }
                    },
                    error: function () {
                        layer.msg("异常！");
                    }
                });
            }
        }

    </script>
</body>

</html>